#!/usr/bin/env node

/**
 * Multi-Tenant SaaS Backend Server
 * Built with Fastify, MongoDB, and JWT Authentication
 */

require('dotenv').config();

const createApp = require('./src/app');

// 创建应用实例
const { start, setupGracefulShutdown } = createApp();

// 设置优雅关闭
setupGracefulShutdown();

// 启动服务器
start().catch((error) => {
  console.error('Failed to start server:', error.message);
  console.error('Error stack:', error.stack);
  process.exit(1);
});